package lining;
// InvalidSlotNumberException.java
//
// Informatics 102 Spring 2012
// Code Example
//
// Below is the definition of a custom exception called
// InvalidSlotNumberException, which we'll throw from any Lineup method
// when it receives an invalid slot number as an argument.  Notice that
// we've extended RuntimeException rather than Exception; we're doing
// that to make this exception "unchecked," meaning that we're allowed
// to throw it from a method without saying "throws," and that we're
// allowed to call methods that throw it without having to say "catch"
// (or say "throws" again).  This is the right choice for this exception,
// since it should never occur unless we have a bug in our program; like
// NullPointerExceptions and IndexOutOfBoundsExceptions, there's not much
// we can do to solve the problem at run time.

public class InvalidSlotNumberException extends RuntimeException
{
	private int invalidSlotNumber;
	
	
	public InvalidSlotNumberException(int invalidSlotNumber)
	{
		super("Invalid lineup slot: " + invalidSlotNumber);
		this.invalidSlotNumber = invalidSlotNumber;
	}
	
	
	
	public int getInvalidSlotNumber()
	{
		return invalidSlotNumber;
	}
}
